<html>
<head><meta charset="utf-8"><title>workspaces and features · t-cargo · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/index.html">t-cargo</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/workspaces.20and.20features.html">workspaces and features</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="207908189"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/workspaces%20and%20features/near/207908189" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/workspaces.20and.20features.html#207908189">(Aug 24 2020 at 23:13)</a>:</h4>
<p>If I have a workspace with multiple crates in it, two of those crates depend on a third-party crate, and one of them enables a feature, will cargo build the third-party crate with that feature and use that for both of my crates? If so, is there any way to tell it to build the third-party crate twice and not enable the feature for my crate that doesn't need it? (Other than breaking up the workspace.)</p>



<a name="207908320"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/workspaces%20and%20features/near/207908320" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Eric Huss <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/workspaces.20and.20features.html#207908320">(Aug 24 2020 at 23:15)</a>:</h4>
<p>If you build the workspace members separately (with separate <code>cargo</code> commands), it will compile the shared dep with different features. If you build the members at the same time, it will be shared.</p>



<a name="207908405"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/workspaces%20and%20features/near/207908405" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/workspaces.20and.20features.html#207908405">(Aug 24 2020 at 23:16)</a>:</h4>
<p>Argh. That feels even less predictable. :(</p>



<a name="207908412"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/workspaces%20and%20features/near/207908412" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/workspaces.20and.20features.html#207908412">(Aug 24 2020 at 23:16)</a>:</h4>
<p>Is there any way to avoid that?</p>



<a name="207908454"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/workspaces%20and%20features/near/207908454" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nagisa <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/workspaces.20and.20features.html#207908454">(Aug 24 2020 at 23:17)</a>:</h4>
<p>not that I know of, the behaviour is inherent to how cargo works.</p>



<a name="207908463"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/workspaces%20and%20features/near/207908463" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Eric Huss <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/workspaces.20and.20features.html#207908463">(Aug 24 2020 at 23:18)</a>:</h4>
<p>not that I know of, either <span aria-label="smile" class="emoji emoji-1f642" role="img" title="smile">:smile:</span></p>



<a name="207908516"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/workspaces%20and%20features/near/207908516" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/workspaces.20and.20features.html#207908516">(Aug 24 2020 at 23:18)</a>:</h4>
<p>I'm aware of cargo wanting to unify and build one copy of a dependency. I just know it <em>wouldn't</em> happen if I used separate workspaces, and I don't want to have to partition my workspaces on the basis of "this feature of this dependency". :(</p>



<a name="207908520"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/workspaces%20and%20features/near/207908520" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nagisa <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/workspaces.20and.20features.html#207908520">(Aug 24 2020 at 23:18)</a>:</h4>
<p>I believe that the other build tools which use <code>cargo metadata</code> as basis of their operation (nix stuff, bazel stuff) do not unify.</p>



<a name="207908524"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/workspaces%20and%20features/near/207908524" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Lokathor <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/workspaces.20and.20features.html#207908524">(Aug 24 2020 at 23:18)</a>:</h4>
<p>you could always enable the feature in the second crate that doesn't currently use it</p>



<a name="207908542"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/workspaces%20and%20features/near/207908542" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/workspaces.20and.20features.html#207908542">(Aug 24 2020 at 23:18)</a>:</h4>
<p><span class="user-mention" data-user-id="224471">@Lokathor</span> Cargo's doing that for me, and that's what I'm trying to <em>avoid</em>.</p>



<a name="207908583"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/workspaces%20and%20features/near/207908583" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nagisa <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/workspaces.20and.20features.html#207908583">(Aug 24 2020 at 23:19)</a>:</h4>
<p>with some dependencies having non-additive features it can be hard to wrap head around where exactly the issue is when cargo unifies.</p>



<a name="207908584"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/workspaces%20and%20features/near/207908584" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Lokathor <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/workspaces.20and.20features.html#207908584">(Aug 24 2020 at 23:19)</a>:</h4>
<p>then i join eric huss and nagisa in having only bad news for you</p>



<a name="207908668"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/workspaces%20and%20features/near/207908668" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/workspaces.20and.20features.html#207908668">(Aug 24 2020 at 23:20)</a>:</h4>
<p>In this case, the feature is additive, but the addition is a problem.</p>



<a name="207908673"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/workspaces%20and%20features/near/207908673" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/workspaces.20and.20features.html#207908673">(Aug 24 2020 at 23:20)</a>:</h4>
<p>Alright. Sounds like I'm splitting a workspace. :(</p>



<a name="207908701"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/workspaces%20and%20features/near/207908701" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Lokathor <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/workspaces.20and.20features.html#207908701">(Aug 24 2020 at 23:20)</a>:</h4>
<p>MCP time</p>



<a name="207909000"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/workspaces%20and%20features/near/207909000" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/workspaces.20and.20features.html#207909000">(Aug 24 2020 at 23:25)</a>:</h4>
<p>Looks like <a href="https://github.com/rust-lang/cargo/issues/5210">https://github.com/rust-lang/cargo/issues/5210</a> would address the non-determinism, by making it <em>always</em> unify no matter what you're building.</p>



<a name="207909071"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/workspaces%20and%20features/near/207909071" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Eric Huss <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/workspaces.20and.20features.html#207909071">(Aug 24 2020 at 23:26)</a>:</h4>
<p><a href="https://github.com/rust-lang/cargo/issues/4463">https://github.com/rust-lang/cargo/issues/4463</a> is the issue re having more control in this situation.</p>



<a name="207909211"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/workspaces%20and%20features/near/207909211" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jonas Schievink  [he/him] <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/workspaces.20and.20features.html#207909211">(Aug 24 2020 at 23:28)</a>:</h4>
<p>uuh, is <a href="https://github.com/rust-lang/cargo/issues/5210">#5210</a> suggesting that all features used by any crate in the workspace will be activated together, all the time? if so it would break the embedded ecosystem</p>



<a name="207909238"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/workspaces%20and%20features/near/207909238" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/workspaces.20and.20features.html#207909238">(Aug 24 2020 at 23:28)</a>:</h4>
<p><span class="user-mention" data-user-id="120518">@Eric Huss</span> Thanks, that was exactly what I was looking for.</p>



<a name="207909274"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/workspaces%20and%20features/near/207909274" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/workspaces.20and.20features.html#207909274">(Aug 24 2020 at 23:29)</a>:</h4>
<p><span class="user-mention" data-user-id="211727">@Jonas Schievink</span> 4463 looks to be addressing the "all the time" problem.</p>



<a name="207909387"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/workspaces%20and%20features/near/207909387" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Eric Huss <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/workspaces.20and.20features.html#207909387">(Aug 24 2020 at 23:30)</a>:</h4>
<p>yea, those two are kinda duplicates of each other. Some times you want the features to be unified and sometimes you don't.  Eventually there should be some mechanism to control that.</p>



<a name="207909417"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/workspaces%20and%20features/near/207909417" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/workspaces.20and.20features.html#207909417">(Aug 24 2020 at 23:30)</a>:</h4>
<p><span class="user-mention" data-user-id="120518">@Eric Huss</span> It sounds like the proposed fix for 4463 is for <code>cargo build --all</code> to have the "don't unify, build each dependency with minimal versions" approach within a workspace. Does it seem reasonable to have a top-level field in a workspace's <code>Cargo.toml</code> to opt into that as the default?</p>



<a name="207909431"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/workspaces%20and%20features/near/207909431" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/workspaces.20and.20features.html#207909431">(Aug 24 2020 at 23:30)</a>:</h4>
<p>Such that <code>cargo build</code> would then have the not-unifying behavior?</p>



<a name="207909432"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/workspaces%20and%20features/near/207909432" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Lokathor <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/workspaces.20and.20features.html#207909432">(Aug 24 2020 at 23:31)</a>:</h4>
<p>if it unified <em>per build profile</em> that's probably fine?</p>



<a name="207909456"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/workspaces%20and%20features/near/207909456" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/workspaces.20and.20features.html#207909456">(Aug 24 2020 at 23:31)</a>:</h4>
<p><span class="user-mention" data-user-id="224471">@Lokathor</span> This is completely unrelated to profiles.</p>



<a name="207909487"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/workspaces%20and%20features/near/207909487" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Lokathor <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/workspaces.20and.20features.html#207909487">(Aug 24 2020 at 23:31)</a>:</h4>
<p>well the reason that all the unification hurts embedded is because of the unifying across profiles bug.</p>



<a name="207909492"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/workspaces%20and%20features/near/207909492" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/workspaces.20and.20features.html#207909492">(Aug 24 2020 at 23:31)</a>:</h4>
<p>That's not the only reason.</p>



<a name="207909495"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/workspaces%20and%20features/near/207909495" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Lokathor <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/workspaces.20and.20features.html#207909495">(Aug 24 2020 at 23:32)</a>:</h4>
<p>fair</p>



<a name="207909544"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/workspaces%20and%20features/near/207909544" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/workspaces.20and.20features.html#207909544">(Aug 24 2020 at 23:32)</a>:</h4>
<p>Suppose you have embedded and non-embedded crates in the same workspace.</p>



<a name="207909556"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/workspaces%20and%20features/near/207909556" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/workspaces.20and.20features.html#207909556">(Aug 24 2020 at 23:32)</a>:</h4>
<p>Say, firmware for a device and a host-side control program for the device.</p>



<a name="207909584"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/workspaces%20and%20features/near/207909584" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/workspaces.20and.20features.html#207909584">(Aug 24 2020 at 23:32)</a>:</h4>
<p>device-firmware depends on foo and opts out of the <code>libc</code> feature. control-program depends on foo and opts into the <code>libc</code> feature. device-firmware breaks.</p>



<a name="207909623"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/workspaces%20and%20features/near/207909623" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Eric Huss <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/workspaces.20and.20features.html#207909623">(Aug 24 2020 at 23:33)</a>:</h4>
<p>i dunno.  I don't think I've seen a well-fleshed out solution.</p>



<a name="207909635"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/workspaces%20and%20features/near/207909635" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nagisa <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/workspaces.20and.20features.html#207909635">(Aug 24 2020 at 23:33)</a>:</h4>
<p><span class="user-mention silent" data-user-id="211727">Jonas Schievink</span> <a href="#narrow/stream/246057-t-cargo/topic/workspaces.20and.20features/near/207909211">said</a>:</p>
<blockquote>
<p>uuh, is <a href="https://github.com/rust-lang/cargo/issues/5210">#5210</a> suggesting that all features used by any crate in the workspace will be activated together, all the time? if so it would break the embedded ecosystem</p>
</blockquote>
<p>why is that the case? building from workspace root already does that.</p>



<a name="207909642"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/workspaces%20and%20features/near/207909642" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/workspaces.20and.20features.html#207909642">(Aug 24 2020 at 23:33)</a>:</h4>
<p>It seems like there are two separate problems here.</p>



<a name="207909721"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/workspaces%20and%20features/near/207909721" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/workspaces.20and.20features.html#207909721">(Aug 24 2020 at 23:34)</a>:</h4>
<p>1) We should have a way for cargo to build all crates in a workspace without unifying features, only unifying within each workspace crate.<br>
2) We should have a way to ask for the behavior you want when building your workspace.</p>



<a name="207909733"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/workspaces%20and%20features/near/207909733" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/workspaces.20and.20features.html#207909733">(Aug 24 2020 at 23:34)</a>:</h4>
<p>(2) is a really easy problem, if we have both mechanisms around.</p>



<a name="207909740"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/workspaces%20and%20features/near/207909740" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/workspaces.20and.20features.html#207909740">(Aug 24 2020 at 23:34)</a>:</h4>
<p>(1) is the hard problem.</p>



<a name="207909749"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/workspaces%20and%20features/near/207909749" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jonas Schievink  [he/him] <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/workspaces.20and.20features.html#207909749">(Aug 24 2020 at 23:35)</a>:</h4>
<p><span class="user-mention silent" data-user-id="123586">nagisa</span> <a href="#narrow/stream/246057-t-cargo/topic/workspaces.20and.20features/near/207909635">said</a>:</p>
<blockquote>
<p><span class="user-mention silent" data-user-id="211727">Jonas Schievink</span> <a href="#narrow/stream/246057-t-cargo/topic/workspaces.20and.20features/near/207909211">said</a>:</p>
<blockquote>
<p>uuh, is <a href="https://github.com/rust-lang/cargo/issues/5210">#5210</a> suggesting that all features used by any crate in the workspace will be activated together, all the time? if so it would break the embedded ecosystem</p>
</blockquote>
<p>why is that the case? building from workspace root already does that.</p>
</blockquote>
<p>But not when building in a specific crate's directory, if I understand correctly. And that behavior is required to avoid enabling incompatible features of dependencies.</p>



<a name="207909773"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/workspaces%20and%20features/near/207909773" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nagisa <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/workspaces.20and.20features.html#207909773">(Aug 24 2020 at 23:35)</a>:</h4>
<p>eh re (1), it would be just a <code>for crate in workspace.crates { cargo build -p crate $@ }</code></p>



<a name="207909779"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/workspaces%20and%20features/near/207909779" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jonas Schievink  [he/him] <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/workspaces.20and.20features.html#207909779">(Aug 24 2020 at 23:35)</a>:</h4>
<p>One of the problems with having to split a workspace is that you lose rust-analyzer support</p>



<a name="207909780"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/workspaces%20and%20features/near/207909780" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nagisa <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/workspaces.20and.20features.html#207909780">(Aug 24 2020 at 23:35)</a>:</h4>
<p>the functionality already exists.</p>



<a name="207909865"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/workspaces%20and%20features/near/207909865" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nagisa <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/workspaces.20and.20features.html#207909865">(Aug 24 2020 at 23:36)</a>:</h4>
<p>Do embedded users typically build with <code>cargo build -p crate</code> or something similar if they use a workspace?</p>



<a name="207909873"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/workspaces%20and%20features/near/207909873" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/workspaces.20and.20features.html#207909873">(Aug 24 2020 at 23:36)</a>:</h4>
<p><span class="user-mention" data-user-id="123586">@nagisa</span> Good point. That might do a little more than is necessary, but it's <em>feasible</em>.</p>



<a name="207909897"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/workspaces%20and%20features/near/207909897" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/workspaces.20and.20features.html#207909897">(Aug 24 2020 at 23:37)</a>:</h4>
<p><span class="user-mention" data-user-id="224471">@Lokathor</span> <span class="user-mention" data-user-id="211727">@Jonas Schievink</span> Either of you fancy a spelunking adventure into cargo code? ;)</p>



<a name="207909917"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/workspaces%20and%20features/near/207909917" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jonas Schievink  [he/him] <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/workspaces.20and.20features.html#207909917">(Aug 24 2020 at 23:37)</a>:</h4>
<p><span class="user-mention silent" data-user-id="123586">nagisa</span> <a href="#narrow/stream/246057-t-cargo/topic/workspaces.20and.20features/near/207909865">said</a>:</p>
<blockquote>
<p>Do embedded users typically build with <code>cargo build -p crate</code> or something similar if they use a workspace?</p>
</blockquote>
<p>Mostly I tend to <code>cd</code> into the crate's directory and build there, in order to pick up the <code>.cargo/config</code> located there</p>



<a name="207909975"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/workspaces%20and%20features/near/207909975" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Lokathor <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/workspaces.20and.20features.html#207909975">(Aug 24 2020 at 23:38)</a>:</h4>
<p><span class="user-mention" data-user-id="239881">@Josh Triplett</span> you'd be hard pressed to find someone less qualified for this task than me XD</p>



<a name="207910026"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/workspaces%20and%20features/near/207910026" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Lokathor <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/workspaces.20and.20features.html#207910026">(Aug 24 2020 at 23:39)</a>:</h4>
<p>Also, i'm with Jonas, having a correct <code>.cargo/config.toml</code> is essential</p>



<a name="207910128"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/workspaces%20and%20features/near/207910128" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/workspaces.20and.20features.html#207910128">(Aug 24 2020 at 23:41)</a>:</h4>
<p>Fair point; it'd be nice to also respect <code>path/to/crate/.cargo/config.toml</code> when doing a top-level build in a workspace.</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>